package com.frost.blog.service;

import com.frost.blog.mapper.BlogMapper;
import com.frost.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {

    @Autowired
    private BlogMapper blogMapper;

    public List<BlogInfo> queryBlogList() {
        return blogMapper.selectAllBlog();
    }

    public BlogInfo queryBlogDetail(Integer id) {
        return blogMapper.selectById(id);
    }

    public Integer updateBlog(BlogInfo blogInfo) {
        return blogMapper.updateBlog(blogInfo);
    }

    public Integer deleteBlog(BlogInfo blogInfo) {
        return blogMapper.updateBlog(blogInfo);
    }

    // 插入博客
    public Integer publishBlog(BlogInfo blogInfo) {
        return blogMapper.insertBlog(blogInfo);
    }

}
